package com.rw.servlet;

import com.rw.jdbc.DB;
import com.rw.jdbc.impl.MySQLDBImpl;
import com.rw.jdbc.impl.OracleDBImpl;
import com.rw.test.TestA;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "HelloServlet", value = "/t")
public class HelloServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //进行请求判断（get请求，post请求，put请求）
        System.out.println("service方法被调用了");
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationcontext.xml");
        DB db = (DB) ac.getBean("db");
        db.select();
    }


}
